package io.test.pipedstream;

import java.io.PipedOutputStream;

/**
 * 消息发送类
 *
 * @author lianmingzhang
 * @create 2017-09-03 下午6:41
 */
public class MeassageSend implements Runnable{
    private PipedOutputStream out=null;
    public MeassageSend() {
        out=new PipedOutputStream();
    }
    public PipedOutputStream getOut(){
        return this.out;
    }
    public void run() {
        String message = "hello, Rollen";
        try {
            out.write(message.getBytes());
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
